package com.egao.common.manage.school;

import com.egao.common.core.annotation.OperLog;
import com.egao.common.core.web.JsonResult;
import com.egao.common.module.statistics.service.SchoolHitsStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 网站浏览情况统计
 *
 * @author pyx
 * @date 2021/5/12
 */
@Api(tags = "网站游览统计")
@RestController
@RequestMapping("${api}")
public class SchoolHitsStatisticsController {

    @Autowired
    private SchoolHitsStatisticsService schoolHitsStatisticsService;

    @PreAuthorize("hasAuthority('school:statistics:hits')")
    @OperLog(value = "网站游览统计", desc = "统计查询")
    @ApiOperation(value = "网站游览统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "createTimeHorizon", value = "发布的时间段 yyyy-MM-dd~yyyy-MM-dd，例：2021-3-10~2021-3-30", dataType = "String")
    })
    @GetMapping("/school/statistics/hits")
    public JsonResult HitsStatistics(String createTimeHorizon){
        return schoolHitsStatisticsService.HitsStatistics(createTimeHorizon);
    }

}
